package com.ykq.controller;

import com.ykq.entity.Users;
import com.ykq.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: qy151-ssm01
 * @description:
 * @author: 闫克起2
 * @create: 2022-06-14 16:00
 **/
@RestController //必须保证该类中所有的方法返回的都是json数据
@RequestMapping("/user")
public class UserController {

    @Autowired //按照类型找
    private UserService userService;

    @RequestMapping("getById")
    public Users getById(Integer userid){
        Users users = userService.findByid(userid);
        return users;
    }

    @RequestMapping("login")
    public String login(){
        System.out.println("=================登录功能==============");
        return "登录成功";
    }

    @RequestMapping("register")
    public String register(){
        System.out.println("注册功能");
        return "成功注册";
    }
}
